<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class System extends Admin_Controller {
    public function __construct(){
        parent::__construct();
        $this->load->library('form_validation');
	}
	public function index(){
        //$this->load->view(THEME_PATH.'/system/list.php');
    }

    public function set_password(){
        $this->load->view(THEME_PATH.'/system.php');
    }

    public function set_password_action(){
        $new_password     = $this->input->post('new_password',true);
        $confirm_password = $this->input->post('confirm_password',true);
        $user_id          = (int)$this->input->post('user_id',true);
        ($new_password != $confirm_password) && e_json('新密码两次输入不一致',0);
        $this->form_validation->set_rules('new_password', '新的密码', 'required');
        $this->form_validation->set_rules('confirm_password', '确认密码', 'required');
        !$this->form_validation->run() && e_json(validation_errors(),0);
        $this->db->update('ca_userinfo',array('password'  =>  md5($new_password)),"user_id='$user_id'");
        e_json('',1);
    }
}
?>